import { ref } from 'vue';
import type { Ref } from 'vue';

export interface FnShowTipsError {
	(title : string, type : 'error' | 'success') : void;
}

export const useShowTipMessage = () : [Ref, FnShowTipsError] => {
	const tipsRef = ref();
	const showTipsError : FnShowTipsError = (title : string, type = 'error') : void => {
		console.log(tipsRef.value);
		tipsRef.value.show({
			title,
			type,
			duration: '3000'
		})
	}

	return [tipsRef, showTipsError]
}